package com.gitee.wsl.doc.prosemirror.state.command.selection

import com.gitee.wsl.doc.prosemirror.state.Command
import com.gitee.wsl.doc.prosemirror.state.CommandDispatch
import com.gitee.wsl.doc.prosemirror.state.EditorState
import com.gitee.wsl.doc.prosemirror.state.selection.AllSelection

class SelectAll : Command {
    override fun exec(
        state: EditorState,
        dispatch: CommandDispatch?,
    ): Boolean {
        dispatch?.invoke(state.tr.setSelection(AllSelection(state.doc)))
        return true
    }
}